var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    p =
        (r.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.G_Mat = null;
                e.W_Mat = null;
                e.lvNpcArenData = {
                    0: {0: "0", 1: "0", 2: "0"},
                    1: {0: "0", 1: "0", 2: "0"},
                    2: {0: "0", 1: "0", 2: "0"},
                    3: {0: "0", 1: "0", 2: "0"},
                    4: {0: "0", 1: "1", 2: "0"},
                    5: {0: "0", 1: "1", 2: "0"},
                    6: {0: "0", 1: "1", 2: "0"}
                };
                e.lvRoadArenData = {
                    0: {0: "0"},
                    1: {0: "0"},
                    2: {0: "0"},
                    3: {0: "0"},
                    4: {0: "1"},
                    5: {0: "1"},
                    6: {0: "1"}
                };
                e.loadCount = 3;
                return e;
            }
            e.prototype.onLoad = function () {
                var t = this;
                CacheDataManager.setNpcLevelAren(this.lvNpcArenData, this.lvRoadArenData);
                this.scheduleOnce(function () {
                    CacheDataManager.G_Mat = t.G_Mat;
                    CacheDataManager.W_Mat = t.W_Mat;
                    QLooperNode.init("Res");
                    t.loadLevel();
                    t.loadLevelData();
                });
            };
            e.prototype.checkLoad = function () {
                this.loadCount--;
                this.loadCount <= 0 &&
                    this.scheduleOnce(function () {
                        CacheDataManager.isLoadingCof = !0;
                    }, 0.2);
            };
            e.prototype.loadLevelData = function () {
                var t = this;
                BundleManager.loadRes(BundleManager.bn.Res, "/Conf/levelData", cc.JsonAsset, function (e, o) {
                    if (o) {
                        CacheDataManager.setLevelRoomData(o.json);
                        SpriteView.setIdSpriteData(o.json.icon, o.json.food, o.json.cfg, o.json.quality_cfg);
                        t.checkLoad();
                    }
                });
                BundleManager.loadRes(BundleManager.bn.Res, "/Conf/shop", cc.JsonAsset, function (t, e) {
                    if (e) {
                        CacheDataManager.setShopData(e.json);
                        PayData.resetPayCof(e.json);
                    }
                });
                BundleManager.loadRes(BundleManager.bn.Res, "/Conf/charRule", cc.JsonAsset, function (e, o) {
                    if (o) {
                        CacheDataManager.setRule(o.json.charRule);
                        t.checkLoad();
                    }
                });
            };
            e.prototype.loadLevel = function () {
                var t = this;
                BundleManager.loadRes(BundleManager.bn.Res, "/map/map001", cc.JsonAsset, function (e, o) {
                    if (o && o.json.data) {
                        t.checkLoad();
                        var a = o.json.data;
                        for (var i in a) {
                            var n = a[i];
                            CacheDataManager.setLevelRoadPath(i, n);
                        }
                    }
                });
            };
            e.prototype.loadLevel2 = function () {};
            e.prototype.init = function () {};
            n([c(cc.Material)], e.prototype, "G_Mat", void 0);
            n([c(cc.Material)], e.prototype, "W_Mat", void 0);
            return n([s], e);
        })(cc.Component));
o.default = p;
